﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="advanced_search.aspx.cs" Inherits="cn_advanced_search" %>


<%@ Register Src="~/cn/UserControl/header.ascx" TagName="header" TagPrefix="uc1" %>
<%@ Register Src="~/cn/UserControl/top_ad.ascx" TagName="top_ad" TagPrefix="uc2" %>
<%@ Register Src="~/cn/UserControl/bottom_ad.ascx" TagName="bottom_ad" TagPrefix="uc3" %>
<%@ Register Src="~/cn/UserControl/footer.ascx" TagName="footer" TagPrefix="uc4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>高级搜索，<%=(new Web.Old_App_Code.BasicSet()).TitleBind() %></title>
    <meta name="Keywords" content="<%=(new Web.Old_App_Code.BasicSet()).KeywordBind() %>" />
    <meta name="Description" content="<%=(new Web.Old_App_Code.BasicSet()).DescriptionBind() %>" />
    <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>css/public.css" type="text/css" rel="stylesheet" />
    <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>css/index.css" type="text/css" rel="stylesheet" />

    <script language="Javascript" type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/jquery-1.6.2.min.js"></script>

    <script language="javascript" type="text/javascript" src="/My97DatePicker/WdatePicker.js"
        charset="utf-8"></script>

    <!--登陆注册 弹出窗口-->
    <style type="text/css" media="all">
        @import "<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/login/thickbox.css";
    </style>
    <link rel="alternate stylesheet" type="text/css" href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/login/1024.css"
        title="1024 x 768" />

    <script src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/login/thickbox.js" type="text/javascript"></script>

    <script src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/login/global.js" type="text/javascript"></script>

    <!-- 头部全部分类 三级导航-->

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/allmenu.js"></script>
    
    <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/skins/idialog.css" rel="stylesheet" />

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/artDialog.js"></script>

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/plugins/iframeTools.source.js"></script>
    
    <script type="text/javascript">
        $(function () {
            $("#btnSearchSubmit").click(function () {
                var urlStr = "?type=search";
                if ($("#txtKeywords").val() != "")
                    urlStr += "&kw=" + escape($("#txtKeywords").val());
                if ($("#selectBrand").val() != "0")
                    urlStr += "&bid=" + $("#selectBrand").val();
                if ($("#selectCategory").val() != "0")
                    urlStr += "&cid=" + $("#selectCategory").val();
                if ($("#txtGoodsNo").val() != "")
                    urlStr += "&gn=" + escape($("#txtGoodsNo").val());
                if ($("#txtMinPrice").val() != "" && $("#txtMaxPrice").val() == "") {
                    $("#txtMaxPrice").select();
                    art.dialog.tips("请输入结束价格！", 1.5);
                    return false;
                }
                if ($("#txtMaxPrice").val() != "" && $("#txtMinPrice").val() == "") {
                    $("#txtMinPrice").select();
                    art.dialog.tips("请输入开始价格！", 1.5);
                    return false;
                }
                if ($("#txtMinPrice").val() != "" && $("#txtMaxPrice").val() != "") {
                    if (parseFloat($("#txtMinPrice").val()) > parseFloat($("#txtMaxPrice").val())) {
                        $("#txtMaxPrice").select();
                        art.dialog.tips("结束价格不能小于开始价格！", 1.5);
                        return false;
                    } else {
                        urlStr += "&price=" + $("#txtMinPrice").val() + "-" + $("#txtMaxPrice").val();
                    }
                }
                if ($("#txtMinDate").val() != "" && $("#txtMaxDate").val() == "") {
                    $("#txtMaxDate").select();
                    art.dialog.tips("请输入结束时间！", 1.5);
                    return false;
                }
                if ($("#txtMaxDate").val() != "" && $("#txtMinDate").val() == "") {
                    $("#txtMinDate").select();
                    art.dialog.tips("请输入开始时间！", 1.5);
                    return false;
                }
                if ($("#txtMinDate").val() != "" && $("#txtMaxDate").val() != "") {
                    var d1 = new Date(Date.parse($("#txtMinDate").val().replace("-", "/")));
                    var d2 = new Date(Date.parse($("#txtMaxDate").val().replace("-", "/")));
                    if (d1 > d2) {
                        $("#txtMaxDate").select();
                        art.dialog.tips("结束时间不能小于开始时间！", 1.5);
                        return false;
                    } else {
                        urlStr += "&minDate=" + $("#txtMinDate").val() + "&maxDate=" + $("#txtMaxDate").val();
                    }
                }
                window.location.href = "goods_list.html" + urlStr;
                return false;
            });
        });
    </script>

</head>
<body>
    <uc1:header ID="Header1" runat="server" />
    <div class="container searchinto">
        <h1>
            商品高级搜索</h1>
        <form action="goods_list.html" method="get">
            <table>
                <tbody>
                    <tr>
                        <td>
                            <label for="idname">
                                关键字：</label></td>
                        <td>
                            <input type="text" id="txtKeywords" name="kws" maxlength="50"/></td>
                        <td>
                            <label for="idname">
                                品牌：</label></td>
                        <td>
                            <select id="selectBrand" name="brand">
                                <option selected="selected" value="0">不限品牌</option>
                                <%Response.Write(BrandBind()); %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="idname">
                                商品分类：</label></td>
                        <td>
                            <select id="selectCategory" name="category">
                                <option selected="selected" value="0">不限分类</option>
                                <%Response.Write(CategoryBind()); %>
                            </select>
                        </td>
                        <td>
                            <label for="idname">
                                商品编号：</label></td>
                        <td>
                            <input type="text" id="txtGoodsNo" name="goodsNo" maxlength="50" /></td>
                    </tr>
                    <tr class="small_input">
                        <td>
                            <label for="idname">
                                价格范围：</label></td>
                        <td colspan="3">
                            <input type="text" id="txtMinPrice" name="minPrice" onpaste="return false" style="ime-mode: disabled"
                                onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')" />-<input
                                    type="text" size="10" id="txtMaxPrice" name="maxPrice" onpaste="return false"
                                    style="ime-mode: disabled" onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')" /></td>
                    </tr>
                    <tr class="small_input">
                        <td>
                            <label for="idname">
                                时间范围：</label></td>
                        <td colspan="3">
                            <input type="text" maxlength="10" id="txtMinDate" name="minDate" onfocus="new WdatePicker(this,'%Y-%M-%D',true,'default')"
                                onpaste="return false" style="ime-mode: disabled" />-<input type="text" maxlength="10"
                                    id="txtMaxDate" name="maxDate" onfocus="new WdatePicker(this,'%Y-%M-%D',true,'default')"
                                    onpaste="return false" style="ime-mode: disabled" /></td>
                    </tr>
                </tbody>
            </table>
            <p class="bottom">
                <input id="btnSearchSubmit" type="submit" class="submit" value="查询" /><input type="reset"
                    class="submit" value="重置" /></p>
        </form>
        <span class="clear"></span>
    </div>
    <uc4:footer ID="Footer1" runat="server" />
</body>
</html>
